package cn.itcast.web.controller.system;

import cn.itcast.domain.system.SysLog;
import cn.itcast.service.system.SysLogService;
import cn.itcast.web.controller.BaseController;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping("/system/log")
public class SysLogController extends BaseController {

    @Autowired
    private SysLogService sysLogService;


    /*
      url：/system/log/list.do
      作用：日志列表
      参数： 无
      返回值： 日志列表 system/log/log-list
*/
    @RequestMapping("/list")
    public String list(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "5") Integer pageSize){
        //1. 找到日志列表
        PageInfo<SysLog> pageInfo = sysLogService.findByPage(pageNum, pageSize, getLoginUserCompanyId());
        //2. 存储到域
        request.setAttribute("pageInfo",pageInfo);
        return "system/log/log-list";
    }

}
